package com.ap.core.validation.message.rules;

import com.ap.core.domain.MerchantDistributorDetailsId;
import com.ap.core.message.managertp.info.SubmitRTPMessageInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.OriginalInfo;

/**
 * User: Ranjit.Singh
 * ValidMerchantIdRule
 */
public class RV0003Rule extends AbstractMerchantDistributorCheckRule<SubmitRTPMessageInfo, OriginalInfo> { 
	
    @Override
    public boolean validate(MessageValidationInfo<SubmitRTPMessageInfo,OriginalInfo> infoObject) {
        final SubmitRTPMessageInfo requestMerchantRegistrationTypeInfo = infoObject.getBoundObject();
        final String distributorIdentification = requestMerchantRegistrationTypeInfo.getRTPSenderInfo().getDistributorInfo().getDistributorId();       
        final MerchantDistributorDetailsId merchantDistributorDetailsId = new MerchantDistributorDetailsId(requestMerchantRegistrationTypeInfo.getRTPSenderInfo().getDetailMerchantInfo().getMerchantInfo().getMerchantId(), distributorIdentification);
        return isMerchantAssociatedWithDistributor(merchantDistributorDetailsId);
    }

}
